home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-11-08 | 4.8 KB | 173 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: Utils.h
- // Release Version: $ 1.0d11 $
- //
- // Author: Henri Lamiraux
- //
- // Copyright: © 1993, 1995 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef UTILS_H
- #define UTILS_H
-
- #ifndef FWGC_H
- #include "FWGC.h"
- #endif
-
- // ----- OS Layer -----
-
- #ifndef FWPOINT_H
- #include "FWPoint.h"
- #endif
-
- #ifndef FWINK_H
- #include "FWInk.h"
- #endif
-
- #ifndef FWSTYLE_H
- #include "FWStyle.h"
- #endif
-
- #ifndef FWGRDEF_H
- #include "FWGrDef.h"
- #endif
-
- #ifndef FWSUSINK_H
- #include "FWSUSink.h"
- #endif
-
- // ----- FOundation Layer -----
-
- #ifndef FWSTDDEF_H
- #include "FWStdDef.h"
- #endif
-
- //========================================================================================
- // Forward Declarations
- //========================================================================================
-
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma import on
- #endif
- class FW_CLASS_ATTR FW_CFacetContext;
- class FW_CLASS_ATTR FW_CRect;
- class FW_CLASS_ATTR FW_CStorageUnitSink;
- class FW_CLASS_ATTR FW_CCloneInfo;
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma import off
- #endif
-
- class FW_CLASS_ATTR CDrawPart;
-
- //========================================================================================
- // Class CGrid
- //========================================================================================
- // index, row and column are 0 based
- //
- // Index Example 0 | 1 | 2
- // ---------
- // 3 | 4 | 5
- //
-
- class FW_CLASS_ATTR CGrid
- {
- public:
- CGrid(unsigned short rows, unsigned short columns,
- const FW_CPoint& position,
- const FW_CPoint& cellInterior,
- FW_CFixed penSize);
-
- FW_Boolean FindCell(const FW_CPoint& where, unsigned long& index) const;
- FW_Boolean FindCell(const FW_CPoint& where, unsigned short& row, unsigned short& column) const;
-
- void GetCellInterior(unsigned short row, unsigned short column, FW_CRect& rect) const;
- void GetCellInterior(unsigned long index, FW_CRect& rect) const;
-
- void GetCellExterior(unsigned short row, unsigned short column, FW_CRect& rect) const;
- void GetCellExterior(unsigned long index, FW_CRect& rect) const;
-
- void GetExteriorGridRect(FW_CRect& rect) const;
- void GetInteriorGridRect(FW_CRect& rect) const;
-
- unsigned long GetIndex(unsigned short row, unsigned short column) const
- {return row * fColumns + column;}
-
- void GetRowColumn(unsigned long index, unsigned short& row, unsigned short& column) const;
-
- void DrawGridBorders(FW_CFacetContext& fc, const FW_PInk& ink = FW_kNormalInk, const FW_PStyle& style = FW_kNormalStyle);
-
- private:
- unsigned short fRows;
- unsigned short fColumns;
- FW_CPoint fPosition;
- FW_CPoint fCellSize;
- FW_CFixed fHalfPenSize;
- };
-
- //========================================================================================
- // Class CWidget
- //========================================================================================
-
- class FW_CLASS_ATTR CWidget
- {
- public:
- CWidget(FW_ResourceId resId);
- ~CWidget();
-
- void Render(FW_CFacetContext& fc, const FW_CRect& rect);
-
- private:
- FW_ResourceId fResId;
-
- };
-
- //========================================================================================
- // class CDrawReadableStream
- //========================================================================================
- // This is a hack until I can pass data through the archiver
-
- class FW_CLASS_ATTR CDrawReadableStream : public FW_CReadableStream
- {
- public:
- CDrawReadableStream(Environment* ev, CDrawPart* drawPart, FW_CStorageUnitSink* sink, FW_CCloneInfo* cloneInfo);
- virtual ~CDrawReadableStream();
-
- Environment* GetEnvironment() const
- {return fEnvironment;}
- CDrawPart* GetDrawPart() const
- {return fDrawPart;}
- FW_CCloneInfo* GetCloneInfo() const
- {return fCloneInfo;}
- ODStorageUnitView* GetStorageUnitView() const
- {return ((FW_CStorageUnitSink*)GetSink())->GetStorageUnitView();}
- private:
- Environment* fEnvironment;
- CDrawPart* fDrawPart;
- FW_CCloneInfo* fCloneInfo;
- };
-
- //========================================================================================
- // class CDrawReadableStream
- //========================================================================================
- // This is a hack until I can pass data through the archiver
-
- class FW_CLASS_ATTR CDrawWritableStream : public FW_CWritableStream
- {
- public:
- CDrawWritableStream(Environment* ev, FW_CStorageUnitSink* sink, FW_CCloneInfo* cloneInfo);
- virtual ~CDrawWritableStream();
-
- Environment* GetEnvironment() const
- {return fEnvironment;}
- FW_CCloneInfo* GetCloneInfo() const
- {return fCloneInfo;}
- ODStorageUnitView* GetStorageUnitView() const
- {return ((FW_CStorageUnitSink*)GetSink())->GetStorageUnitView();}
- private:
- Environment* fEnvironment;
- FW_CCloneInfo* fCloneInfo;
- };
-
- #endif